{% extends "park/base.html" %}
{% block content %}
<script type="text/javascript">
    var primary_menu = "menu_0";
    var sub_menu = "menu_0_0";
</script>
<div class="col-md-12">
    <div class="panel panel-primary">
        <div class="panel-heading">
            <div class="panel-title"><h3>园区基本信息</h3></div>
            <div class="panel-options">
                <a href="#" data-rel="collapse"><i class="entypo-down-open"></i></a>
                <!-- <a href="#" data-rel="reload"><i class="entypo-arrows-ccw"></i></a> -->
            </div>
        </div>
        <div class="panel-body">
            <div class="row">
                <div class="col-md-12">
                    <form id='editbasicinfo' role="form" method="post" action="" enctype="multipart/form-data" class="form-horizontal form-groups-bordered">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">园区名称</label>
                            <div class="col-sm-5">
                                <input type="text" class="form-control" name="name" placeholder="请输入园区名称" value="{{ p.name }}" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">园区级别</label>
                            <div class="col-sm-2">
                                <select  name="rank" value='{{ p.rank }}'  class="form-control">
                                    <option>请选择园区级别</option>
                                    <option value='国家级'>国家级</option>
                                    <option value='省级'>省级</option>
                                    <option value='市级'>市级</option>
                                    <option value='其他'>其他</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">所在市县（地址）</label>
                            <div class="col-sm-5">
                                <input type="text"  name="address" class="form-control datepicker" data-start-view="1" value="{{ p.address }}"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">园区地图附件</label>
                            <div class="col-sm-5">
                                <input name="address_path" style="margin-top: 10px;padding: 0px; height: 42px" type="file" class="form-control" id="field-file" placeholder="选择地图文件上传">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">建立时间</label>
                            <div class="col-sm-3">
                                <input type="text"  name="create_time" class="form-control datepicker" data-start-view="1" value="{{ p.create_time }}"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">占地面积</label>
                            <div class="col-sm-5">
                                <input type="text"  name="area" class="form-control"  placeholder="请输入占地面积" value="{{ p.area }}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">主要产业类型</label>
                            <div class="col-sm-5">
                                <textarea  name="production_type" class="form-control"  placeholder="请输入主要产业类型" >{{ p.production_type }}</textarea>

                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">园区简介</label>
                            <div class="col-sm-5">
                                <textarea name="info" class="form-control"  placeholder="园区简介" >{{ p.info }}</textarea>
                            </div>
                        </div>
                        <div id="_submitLoad" class="submitLoad" style="display:none;">
                            <div class="col-sm-offset-3  col-sm-5">
                                <div class="row" style="margin: 20px 0px;font-weight: bolder;color: #51a351;font-size:14px;">
                                    <img width="20" height="20" src="/static/images/loading.jpg"><span> 提交中......</span>
                                </div>
                            </div>
                        </div>
                        <div id="_fromBtn" class="form-group" style="margin: 10px 0px">
                            <div class="col-sm-offset-3 col-sm-5">
                                <input type="submit" class="btn btn-success btn-lg" value="保存">
                                <!-- <input class="btn btn-info btn-lg" type="reset" value="重置"/> -->
                            </div>
                        </div>
                </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}

{% block js %}
<script src="/static/js/city-choose.js"></script>
<script language="javascript">
    var dizhi = "{{basic.facilities_add0}}";
    $(function(){
        var flag = $("input[name='parent_company']:checked").val();
        if (flag==1) {
            $(".parentCompany").show();
            $(".parentCompany").eq(0).find("input").attr("datatype","*");
            $(".parentCompany").eq(1).find("input").attr("datatype","n");
        }else{
            $(".parentCompany").hide().find("input").removeAttr('datatype');
        }
        $(document).area("s_province","s_city","s_county");//调用插件
        $(document).area("m_province","m_city","m_county");//调用插件
        $("#s_province,#m_province").trigger("change")

        $("input[name='parent_company']").click(function(){
            var flag = $("input[name='parent_company']:checked").val();
            console.log(flag)
            if (flag==1) {
                $(".parentCompany").show();
                $(".parentCompany").eq(0).find("input").attr("datatype","*");
                $(".parentCompany").eq(1).find("input").attr("datatype","n");
            }else{
                $(".parentCompany").hide().find("input").removeAttr('datatype');
            }
        })
        
    });
    function getNextElement (field) {
        var form = field.form;
        for (var e = 0; e < form.elements.length; e++)
            if (field == form.elements[e])
                break;
        return form.elements[++e % form.elements.length];
    }


</script>
{% endblock %}
